<?php


use PHPUnit\Framework\TestCase;
use Xp130\Rank\ConfigLoader;
use Xp130\Rank\Leaderboard;

final class LeaderboardComponentTest extends TestCase
{
    private Leaderboard $rank;

    protected function setUp(): void
    {
        parent::setUp();
        $this->feedbackComponent = Feedback::getInstance(new ConfigLoader(null));
    }

    public function testInitializeTable(): void
    {
        $this->feedbackComponent->initializeTable();
        $this->assertTrue(true);
    }

    public function testAddAndGetFeedback(): void
    {
        $newFeedbackId = $this->feedbackComponent->addFeedback(123,"John Doe",'john.doe@example.com',null);

        $feedbacks = $this->feedbackComponent->getAllFeedbacks();
        $this->assertGreaterThan(0, count($feedbacks));
        $this->assertEquals('John Doe', $feedbacks[0]['name']);
    }
}